package WangYi.Two;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        int i = new Solution().minJump(arr);
        System.out.println(i);
    }
}

class Solution {
    public int minJump(int[] jump) {
        int[] dp = new int[jump.length];
        dp[jump.length - 1] = 1;
        for (int i = jump.length - 2; i >= 0; i--) {
            if (i + jump[i] >= jump.length) {
                dp[i] = 1;
            } else {
                dp[i] = dp[i + jump[i]] + 1;
            }

            for (int j = i + 1; dp[j] >= dp[i] + 1 && j < dp.length; j++) {
                dp[j] = dp[i] + 1;
            }
        }
        return dp[0];
    }
}
